module FeatureTemplate 
    ( Feature(..) 
    , parse
    )
where
import Data.Binary 
import Text

type Row = Int
type Col = Int

data Feature =
          Cell Row Col
        | Rect Row Col Row Col
        | Row Row
        | Index Feature
        | MarkNull Feature
        | Cat [Feature]
        | Cart Feature Feature
        | Lower Feature
        | Suffix Int Feature
        | Prefix Int Feature
        | WordShape Feature
    deriving (Show,Read)

parse :: Txt -> Feature
parse =  Text.read . Text.unwords . Text.lines

instance Binary Feature where
    put f = put $ Text.show f
    get = do
      f <- get
      return $ Text.read f
